/**
 * @file abscombination.h
 * @brief AbsCombination class definition
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * @author VestniK (Sergey N.Vidyuk)
 * @date 11 Oct 2008
 */
#ifndef _AbsCombination_H_
#define _AbsCombination_H_

#include <QtCore>

#include "tile.h"
#include "mjntypes.h"
#include "mjnexceptions.h"

namespace mjn {

   /** @brief Representation of abstract tiles combination
    *
    * This class contains common methods for all combinations classes
    * Chou, Pung, Kong, TilesPair.
    */
   class AbsCombination {
      public:
         AbsCombination() {};
         virtual ~AbsCombination() {};

         /// Validate combination
         virtual bool isValid() const = 0;
         /// Calculates combination score
         unsigned score(WindType roundWind,WindType playerWind) const;
         /// Calculates combination multiplication factor
         unsigned multiplyFactor(WindType roundWind,WindType playerWind) const;

         /// Adds tile to combination
         bool addTile(Tile t);
         /// Clear tiles list
         void clear() {tiles.clear();};
         /// Returns combination size
         int getCombinationSize() const {return CombinationSize;};
         /// Returns added tiles count
         int getTilesCount() const {return tiles.count();};
      protected:
         QList<Tile> tiles;
         /// Class specific score calculation
         virtual unsigned calculateScore(WindType roundWind,WindType playerWind) const = 0;
         /// Class specific multiplication factor calculation
         virtual unsigned calculateMultiplyFactor(WindType roundWind,WindType playerWind) const = 0;
         /** @brief Combination size
          *
          * This variable should contain combination size. It should be
          * initialized in constructor of combination subclass and never
          * be changed
          */
         int CombinationSize;
   };

} // namespace mjn

#endif
